MobX Quick Start Guide: Supercharge the client state in your React apps with MobX by Pavan Podila & Michel Weststrate
Author:Pavan Podila & Michel Weststrate [Podila, Pavan]
Language: eng
Format: epub
Tags: COM051260 - COMPUTERS / Programming Languages / JavaScript, COM060180 - COMPUTERS / Web / Web Services and APIs, COM060160 - COMPUTERS / Web / Web Programming
Publisher: Packt Publishing
Published: 2018-07-25T23:00:00+00:00
this.loginState = 'completed';
yield this.sendAnalytics();
this.loginState = 'reported';
yield this.delay(3000);
});
}
new AuthStore().login();
Notice the use of the generator function*() instead of the regular function, which is passed as argument to flow(). Structurally, it is no different than the async-await style of code, but has the added benefit of automatically wrapping the parts of code following a yield with an action(). With flow(), you are back to being more declarative with your async code.
There is yet another benefit that flow() gives you. It is the ability to cancel execution of the async code.
The return value of flow() is a function that you can invoke to execute the async code. This is the login method of the AuthStore, in the preceding example. When you call new AuthStore().login(), you get back a promise that has been enhanced by MobX with the cancel() method:
const promise = new AuthStore().login2();
promise.cancel(); // prematurely cancel the async code
This is useful for canceling a long-running operation by giving user-level control.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
The Mikado Method by Ola Ellnestam Daniel Brolund(27113)
Hello! Python by Anthony Briggs(25968)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(25303)
Kotlin in Action by Dmitry Jemerov(24412)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(23607)
Dependency Injection in .NET by Mark Seemann(23326)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(21961)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(20865)
Grails in Action by Glen Smith Peter Ledbrook(19880)
Adobe Camera Raw For Digital Photographers Only by Rob Sheppard(17076)
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(16842)
Secrets of the JavaScript Ninja by John Resig & Bear Bibeault(14472)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(12592)
Jquery UI in Action : Master the concepts Of Jquery UI: A Step By Step Approach by ANMOL GOYAL(11875)
A Developer's Guide to Building Resilient Cloud Applications with Azure by Hamida Rebai Trabelsi(10654)
Hit Refresh by Satya Nadella(9242)
The Kubernetes Operator Framework Book by Michael Dame(8591)
Exploring Deepfakes by Bryan Lyon and Matt Tora(8449)
Robo-Advisor with Python by Aki Ranin(8392)